IF EXISTS (SELECT * FROM sysobjects WHERE id = object_id(N'[dbo].[GetArraDepartmentAdmin]') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
BEGIN
	DROP PROCEDURE dbo.GetArraDepartmentAdmin
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

/******************************************************************
*  Name:  GetArraDepartmentAdmin
* Purpose:  Procedure to know if a user is Arra Dept Admin or Not.
*
* PARAMETERS
* Name    			Description					
* -------------  	-------------------------------------------
* @admPersonId      AdmPerson Id
*****************************************************************/

CREATE PROCEDURE [dbo].[GetArraDepartmentAdmin](
	@admPersonId INTEGER
)
AS
BEGIN

	SELECT count(*) 
	FROM 
		ArraAgreement
	WHERE
		DepartmentManagerAdmPersonId = @admPersonId

END

--Exec GetArraDepartmentAdmin 224277

 